//
//  ExtensionTableCell.m
//  19_汽车之家
//
//  Created by dllo on 16/8/9.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "ExtensionTableCell.h"
#import "Extension.h"
#import "UIImageView+WebCache.h"

@interface ExtensionTableCell ()
@property (nonatomic, strong) UIImageView *rightImgView;
@property (nonatomic, strong) UILabel *rightSeriesnameLabel;
@property (nonatomic, strong) UIImageView *middleImgView;
@property (nonatomic, strong) UILabel *middleSeriesnameLabel;
@property (nonatomic, strong) UIImageView *leftImgView;
@property (nonatomic, strong) UILabel *leftSeriesnameLabel;
@end

@implementation ExtensionTableCell

- (void)setExtensionArray:(NSMutableArray<Extension *> *)extensionArray {
    _extensionArray = extensionArray;
    Extension *rightExtension = _extensionArray[0];
    Extension *middleExtension = _extensionArray[1];
    Extension *leftExtension = _extensionArray[2];    
    [_rightImgView sd_setImageWithURL:[NSURL URLWithString:rightExtension.img]];
    _rightSeriesnameLabel.text = rightExtension.seriesname;
    [_middleImgView sd_setImageWithURL:[NSURL URLWithString:middleExtension.img]];
    _middleSeriesnameLabel.text = middleExtension.seriesname;
    [_leftImgView sd_setImageWithURL:[NSURL URLWithString:leftExtension.img]];
    _leftSeriesnameLabel.text = leftExtension.seriesname;
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        _rightImgView = [[UIImageView alloc] init];
        [self.contentView addSubview:_rightImgView];
        _rightSeriesnameLabel = [[UILabel alloc] init];
        [self.contentView addSubview:_rightSeriesnameLabel];
        _middleImgView = [[UIImageView alloc] init];
        [self.contentView addSubview:_middleImgView];
        _middleSeriesnameLabel = [[UILabel alloc] init];
        [self.contentView addSubview:_middleSeriesnameLabel];
        _leftImgView = [[UIImageView alloc] init];
        [self.contentView addSubview:_leftImgView];
        _leftSeriesnameLabel = [[UILabel alloc] init];
        [self.contentView addSubview:_leftSeriesnameLabel];
    }
    return self;
}

- (void)layoutSubviews {
    [super layoutSubviews];
    _rightImgView.frame = CGRectMake(23, 14, 89, 59);
    _rightSeriesnameLabel.frame = CGRectMake(23, 80, 89, 21);
    _middleImgView.frame = CGRectMake(163, 13, 89, 59);
    _middleSeriesnameLabel.frame = CGRectMake(163, 79, 89, 21);
    _leftImgView.frame = CGRectMake(300, 13, 89, 59);
    _leftSeriesnameLabel.frame = CGRectMake(300, 79, 89, 21);
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
